Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add time window for trace get method in span store interface #6242

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

rim99
Copy link
Contributor

@rim99 rim99 commented Nov 23, 2024

Which problem is this PR solving?

Part of #4150

Description of the changes

Refactor trace get method in span store interface:

  • use struct instead of literal trace id
  • add time window in the new struct

How was this change tested?

  • unit test

Checklist

@rim99 rim99 force-pushed the refactor-span-store-interface-add-time-window branch from fcd8538 to 5e2d862 Compare November 23, 2024 01:40
@rim99 rim99 marked this pull request as ready for review November 23, 2024 01:41
@rim99 rim99 requested a review from a team as a code owner November 23, 2024 01:41
@rim99 rim99 requested a review from albertteoh November 23, 2024 01:41
plugin/storage/grpc/shared/grpc_handler.go Outdated Show resolved Hide resolved
plugin/storage/grpc/shared/grpc_client_test.go Outdated Show resolved Hide resolved
plugin/storage/es/spanstore/reader.go Show resolved Hide resolved
@@ -266,7 +266,10 @@ func (aH *APIHandler) tracesByIDs(ctx context.Context, traceIDs []model.TraceID)
var traceErrors []structuredError
retMe := make([]*model.Trace, 0, len(traceIDs))
for _, traceID := range traceIDs {
if trc, err := aH.queryService.GetTrace(ctx, traceID); err != nil {
query := spanstore.GetTraceParameters{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somewhere here the timestamps must be handled, so leave a TODO. This could be another PR to precede this one, where we introduce timestamps params in /api/trace/{traceID} API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this comment resolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added more TODOs

cmd/query/app/grpc_handler.go Outdated Show resolved Hide resolved
cmd/query/app/grpc_handler.go Outdated Show resolved Hide resolved
@@ -136,7 +136,10 @@ func (h *HTTPGateway) getTrace(w http.ResponseWriter, r *http.Request) {
if h.tryParamError(w, err, paramTraceID) {
return
}
trc, err := h.QueryService.GetTrace(r.Context(), traceID)
query := spanstore.GetTraceParameters{
TraceID: traceID,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy timestamps from request

Copy link
Contributor Author

@rim99 rim99 Nov 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODO, since API changes will be in another PR: #6248

cmd/query/app/apiv3/grpc_handler.go Outdated Show resolved Hide resolved
gw.getTracesAndVerify(t, "/api/v3/traces/"+traceID.String(), traceID)
trace, query := makeTestTrace()
gw.reader.On("GetTrace", matchContext, query).Return(trace, nil).Once()
gw.getTracesAndVerify(t, "/api/v3/traces/"+query.TraceID.String(), query.TraceID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could introduce a preliminary PR that adds timestamps args to the REST API calls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here: #6248

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that PR doesn't seem to compile, can you get it to green state?

Copy link
Contributor Author

@rim99 rim99 Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a PR contains changes of current PR, and the PR above: #6258

cmd/jaeger/internal/integration/span_reader.go Outdated Show resolved Hide resolved
@rim99 rim99 force-pushed the refactor-span-store-interface-add-time-window branch from 5e2d862 to 5610442 Compare November 24, 2024 03:00
Copy link

codecov bot commented Nov 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.14%. Comparing base (10cb6a9) to head (b9c4ceb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6242      +/-   ##
==========================================
+ Coverage   96.10%   96.14%   +0.03%     
==========================================
  Files         360      360              
  Lines       20429    20475      +46     
==========================================
+ Hits        19634    19685      +51     
+ Misses        607      603       -4     
+ Partials      188      187       -1     
Flag Coverage Δ
badger_v1 8.96% <10.00%> (-0.02%) ⬇️
badger_v2 1.63% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 14.94% <12.50%> (-0.03%) ⬇️
cassandra-4.x-v2-auto 1.57% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.57% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 14.94% <12.50%> (-0.03%) ⬇️
cassandra-5.x-v2-auto 1.57% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.57% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 18.63% <12.50%> (-0.02%) ⬇️
elasticsearch-7.x-v1 18.70% <12.50%> (-0.03%) ⬇️
elasticsearch-8.x-v1 18.86% <12.50%> (-0.02%) ⬇️
elasticsearch-8.x-v2 1.62% <0.00%> (-0.01%) ⬇️
grpc_v1 10.59% <55.00%> (+0.09%) ⬆️
grpc_v2 7.95% <22.50%> (+0.02%) ⬆️
kafka-v1 9.29% <5.00%> (-0.02%) ⬇️
kafka-v2 1.63% <0.00%> (-0.01%) ⬇️
memory_v2 1.62% <0.00%> (-0.02%) ⬇️
opensearch-1.x-v1 18.75% <12.50%> (-0.01%) ⬇️
opensearch-2.x-v1 18.75% <12.50%> (-0.01%) ⬇️
opensearch-2.x-v2 1.62% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.45% <0.00%> (-0.01%) ⬇️
unittests 95.02% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rim99 rim99 force-pushed the refactor-span-store-interface-add-time-window branch 3 times, most recently from 289e0a8 to 7c37eee Compare November 24, 2024 04:08
@rim99 rim99 mentioned this pull request Nov 24, 2024
4 tasks
@yurishkuro yurishkuro added the changelog:new-feature Change that should be called out as new feature in CHANGELOG label Nov 24, 2024
@rim99 rim99 force-pushed the refactor-span-store-interface-add-time-window branch from fd25a38 to 16da94c Compare November 24, 2024 23:51
@rim99
Copy link
Contributor Author

rim99 commented Nov 25, 2024

PR updated, please review, thanks @yurishkuro

@rim99 rim99 force-pushed the refactor-span-store-interface-add-time-window branch from 56f361a to 5edb49b Compare November 25, 2024 23:27
Comment on lines 109 to 110
for _, input := range inputs {
tsc := newTestServerClient(t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for _, input := range inputs {
tsc := newTestServerClient(t)
for _, input := range inputs {
t.Run(input.name, func(t *testing.T) {
tsc := newTestServerClient(t)
...
})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rim99 rim99 force-pushed the refactor-span-store-interface-add-time-window branch from af0dee9 to 491c826 Compare November 26, 2024 12:21
@yurishkuro
Copy link
Member

@rim99 could you please resolve the conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/storage changelog:new-feature Change that should be called out as new feature in CHANGELOG enhancement storage/badger Issues related to badger storage storage/cassandra storage/elasticsearch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants